package Controller;


import lejos.nxt.*;
import lejos.robotics.proposal.DifferentialPilot;
import lejos.robotics.subsumption.*;

public class LineFollower implements Behavior{
	private boolean suppressed = false;
	private DifferentialPilot pilot;
	private LightSensor lightSensor;		
	
	
	public LineFollower(LightSensor lightSensor, DifferentialPilot pilot){
		this.lightSensor = lightSensor;
		this.pilot = pilot;
	}
	
	@Override
	public boolean takeControl(){		
		return lightSensor.readValue() > 30;
	}	
	
	@Override
	public void action(){
		suppressed = false;
		
		
	}
	
	@Override
	public void suppress(){
		pilot.stop();
		suppressed = true;
	}

}
